package com.neuedu.web.controller.system;

import java.util.List;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neuedu.common.annotation.Log;
import com.neuedu.common.core.controller.BaseController;
import com.neuedu.common.core.domain.AjaxResult;
import com.neuedu.common.enums.BusinessType;
import com.neuedu.system.domain.BBBYunongLandLease;
import com.neuedu.system.service.IBBBYunongLandLeaseService;
import com.neuedu.common.utils.poi.ExcelUtil;
import com.neuedu.common.core.page.TableDataInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 招商引资Controller
 *
 * @author ruoyi
 * @date 2024-12-17
 */
@RestController
@RequestMapping("/system/BBBlease")
@Tag(name = "【招商引资】管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class BBBYunongLandLeaseController extends BaseController
{
    private final IBBBYunongLandLeaseService bBBYunongLandLeaseService;

    /**
     * 查询招商引资列表
     */
    @Operation(summary = "查询招商引资列表")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:list')")
    @GetMapping("/list")
    public TableDataInfo list(BBBYunongLandLease bBBYunongLandLease)
    {
        startPage();
        List<BBBYunongLandLease> list = bBBYunongLandLeaseService.selectBBBYunongLandLeaseList(bBBYunongLandLease);
        return getDataTable(list);
    }

    /**
     * 导出招商引资列表
     */
    @Operation(summary = "导出招商引资列表")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:export')")
    @Log(title = "招商引资", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BBBYunongLandLease bBBYunongLandLease)
    {
        List<BBBYunongLandLease> list = bBBYunongLandLeaseService.selectBBBYunongLandLeaseList(bBBYunongLandLease);
        ExcelUtil<BBBYunongLandLease> util = new ExcelUtil<BBBYunongLandLease>(BBBYunongLandLease.class);
        util.exportExcel(response, list, "招商引资数据");
    }

    /**
     * 获取招商引资详细信息
     */
    @Operation(summary = "获取招商引资详细信息")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bBBYunongLandLeaseService.selectBBBYunongLandLeaseById(id));
    }

    /**
     * 新增招商引资
     */
    @Operation(summary = "新增招商引资")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:add')")
    @Log(title = "招商引资", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BBBYunongLandLease bBBYunongLandLease)
    {
        return toAjax(bBBYunongLandLeaseService.insertBBBYunongLandLease(bBBYunongLandLease));
    }

    /**
     * 修改招商引资
     */
    @Operation(summary = "修改招商引资")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:edit')")
    @Log(title = "招商引资", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BBBYunongLandLease bBBYunongLandLease)
    {
        return toAjax(bBBYunongLandLeaseService.updateBBBYunongLandLease(bBBYunongLandLease));
    }

    /**
     * 删除招商引资
     */
    @Operation(summary = "删除招商引资")
    @PreAuthorize("@ss.hasPermi('system:BBBlease:remove')")
    @Log(title = "招商引资", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable( name = "ids" ) Long[] ids)
    {
        return toAjax(bBBYunongLandLeaseService.deleteBBBYunongLandLeaseByIds(ids));
    }
}
